//
//  HttpManager.h
//  MetenEnglish
//
//  Created by Hsn on 14/11/19.
//  Copyright (c) 2014年 Shenzhen Securities Information Co., Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CourseModel.h"
#import "Tools.h"

@protocol LoginDelegate <NSObject>

- (void)loginSuccess;

@end

@protocol HttpManagerDelegate <NSObject>

- (void)searchCoursesSuccess:(NSArray *)courses;
- (void)courseListSuccess:(NSArray *)courses;

@end

@protocol ReserveCourseDelegate <NSObject>

- (void)reserveCourseSuccess:(CourseModel *)model
         reserveCourseResult:(id)result;
- (void)standByCourseSuccess:(CourseModel *)model
                 queueResult:(id)result;
- (void)cancelStandBySuccess:(CourseModel *)model
           cancelQueueResult:(id)result;

@end

@protocol UserLevelDelege <NSObject>

- (void)getUserLevel:(NSString *)level;

@end

@protocol CancelCourseDelegate <NSObject>

- (void)cancelCourseResult:(id)result;

@end

@interface HttpManager : NSObject

@property (nonatomic,assign)id<HttpManagerDelegate> delegate;
@property (nonatomic,assign)id<LoginDelegate> loginDelegate;
@property (nonatomic,assign)id<ReserveCourseDelegate> reserveDelegate;
@property (nonatomic, assign) id<CancelCourseDelegate> cancelCourseDelegate;
@property (nonatomic, strong) NSMutableArray *reservedCourses; //已订课程记录
@property (nonatomic, assign) BOOL isFresh;

+ (HttpManager *)share;


- (void)loginMetenWithUserName:(NSString *)userName
                      password:(NSString *)password;

/**
 *  登录
 *
 *  @param userName  用户名
 *  @param password  密码
 *  @param checkCode 验证码
 */
- (void)loginMetenWithUserName:(NSString *)userName
                      password:(NSString *)password
                     checkCode:(NSString *)checkCode;

/**
 *  搜索已订课程
 *
 *  @param pageIndex 分页
 */
- (void)searchCourses:(NSInteger)pageIndex;

/**
 *  获取课程列表(可订课,排队等等)
 *
 *  @param branchId       校区ID
 *  @param productLevelId 课程级别(M0 = 0,  M1 = 1)
 */
- (void)courseList:(NSUInteger)branchId
    productLevelId:(NSUInteger)productLevelId;

/**
 *  订课
 *
 *  @param courseID 课程ID
 *  @param model    课程Model
 */
- (void)reserveCourse:(NSString *)courseID
      requestUserInfo:(CourseModel *)model;

/**
 *  退课
 *  @param courserId 课程ID
 */
- (void)cancelReservedCourse:(NSString *)courseId;

/**
 *  排队
 *
 *  @param courseModel 课程model
 */
- (void)standByCourse:(CourseModel *)model;

/**
 *  取消排队
 *
 *  @param courseModel 课程model
 */
- (void)cancelStandByCourse:(CourseModel *)model;

@end
